package com.作业.Day9;

import java.util.Scanner;

public class Homework2 {
    public static void main(String[] args) {
        System.out.println("***欢迎进入注册系统***");
        Scanner scanner = new Scanner(System.in);
        while(true){
            int a=0;
            System.out.print("请输入身份证:");
            String identity = scanner.next();
            System.out.print("请输入手机号:");
            String phone = scanner.next();
            System.out.print("请输入座机号:");
            String number = scanner.next();
            if(!(identity.length()==16||identity.length()==18)){
                System.out.println("身份证号必须是16位或18位");
            }
            else
                a++;
            if(phone.length()!=11){
                System.out.println("手机号码必须11位！");
            }
            a++;
            String[] split = number.split("-");
            if(split[0].length()!=4&&split[1].length()!=7)
            {
                System.out.println("座机号码区号必须为4位，电话号码必须是7位");
            }
            else
                a++;
            if(a==3){
                System.out.println("注册成功");
                break;
            }
        }

    }
}
